import request from '@/utils/request'
// 新增权限
export function sentrouter(data) {
  return request({
    url: '/permission/increase',
    method: 'post',
    data: data,
  })
}
// 获取所有权限信息
export function listall() {
  return request({
    url: '/permission/list/all',
    method: 'post',
  })
}
// 根据主键id获取权限信息
export function permission() {
  return request({
    url: '/permission/info/get/by-id',
    method: 'get',
  })
}
// 修改权限
export function changeper(data) {
  return request({
    url: '/permission/update',
    method: 'post',
    data: data,
  })
}
// 删除权限
export function excision(id) {
  return request({
    url: '/permission/delete/tree',
    method: 'get',
    params: {
      id: id,
    },
  })
}
// 为角色添加权限
export function addpermission(data) {
  return request({
    url: '/permission/add',
    method: 'post',
    data: data,
  })
}
// 获取所有网格区域信息
export function patrol(current, limit) {
  return request({
    url: '/patrol-grid/list',
    method: 'get',
    params: {
      current: current,
      limit: limit,
    },
  })
}
// 添加修改网格
export function createOrUpdate(data) {
  return request({
    url: '/patrol-grid/createOrUpdate',
    method: 'post',
    data: data,
  })
}
// 删除
export function RRdelete(id) {
  return request({
    url: '/patrol-grid/delete',
    method: 'post',
    params: {
      id: id,
    },
  })
}
// 删除
export function getroute(roleId) {
  return request({
    url: '/permission/get/by/role-id',
    method: 'get',
    params: {
      roleId: roleId,
    },
  })
}
// 取消权限
export function cancel(data) {
  return request({
    url: '/permission/cancel',
    method: 'post',
    data: data,
  })
}
// 取消权限
export function permissionchange(data) {
  return request({
    url: '/permission/add/or/cancel',
    method: 'post',
    data: data,
  })
}
// 查询单兵
export function deviceList(pageNo, pageSize) {
  return request({
    url: '/device-soldier/deviceList',
    method: 'get',
    params: {
      pageNo: pageNo,
      pageSize: pageSize,
    },
  })
}
// 删除信息
export function deletesoldier(id) {
  return request({
    url: '/device-soldier/delete',
    method: 'post',
    params: {
      id: id,
    },
  })
}
// 保存或修改
export function saveorupdate(data) {
  return request({
    url: '/device-soldier/saveorupdate',
    method: 'post',
    data: data,
  })
}

export default {
  sentrouter,
  listall,
  permission,
  changeper,
  excision,
  addpermission,
  patrol,
  createOrUpdate,
  RRdelete,
  getroute,
  cancel,
  permissionchange,
  deviceList,
  deletesoldier,
  saveorupdate,
}
